import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'

export default defineConfig({
	main: {
		plugins: [externalizeDepsPlugin()]
	},
	preload: {
		plugins: [externalizeDepsPlugin()]
	},
	renderer: {
		resolve: {
			alias: {
				'@': resolve('src/renderer/src')
			}
		},
		plugins: [
			vue(),
			AutoImport({
				include: [
					/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
					/\.vue$/,
					/\.vue\?vue/ // .vue
				],
				dirs: ['./src'],
				imports: ['vue', 'vue-router'],
				dts: 'src/types/auto-imports.d.ts' // 生成类型声明文件的路径
			})
		]
	}
})
